Filip Gacina

Home / opinions

Code is subjective

"Reason is, and ought only to be the slave of the passion"
- David Hume, A Treatise of Human Nature

Programmers argue about programming languages, text editors, paradigms, frameworks and styles all the time. Most of it is a complete waste of time, because most of the subject matter comes down to personal preference. This is because most of the time programmers are talking about code, the only objective property of which is the line count.

Applications on the other hand are mostly objective, there are plenty of parameters you can objectively measure, such as runtime performance, load times, memory usage, etc. But this post is not about that, so let's go back to code.

Example

I consider the following style of C++ code ideal:

/*
    - Types are written in { Pascal_Snake_Case }.
    - Data members, local variables and functions are written in { snake_case }.
    - Constants are written in { ALL_CAPS }.
    - Definitions and declarations are aligned when possible.
    - Only use 1 namespace.
    - etc..
*/
namespace example {

    struct Some_POD_Type {
        int   data;
        float more_data;
    };

    void
    do_something_with_POD(Some_POD_Type& pod) {
        int local_variable = pod.data;
        int thing_index    = pod.data * 2;
        ...
        pod.data = thing_index;
    }

    constexpr int SOME_CONSTANT = 4096;

    class Some_Container_Type {
    public:
        void
        push_back(My_Type t) {
            ...
        }
    }

}

To me, this is readable and easy to understand. To someone else this code is likely the worst piece of code they have ever seen. The fun part is - both of us are correct. I did not choose to like this style, I only discovered I like this style. Same as how the straw-man programmer discovered distaste for this code.

We do not choose our likes and dislikes, we discover them.

We are not clones. If we all agreed on everything there would be nothing good, because good only exists when you have something you perceive as bad to compare against. Disagreements are good in that sense. But when engaging in disagreements, you have to keep this personal preference barrier in your mind. Once you hit that barrier, it's over, no progress will be made past that point and there is usually no right or wrong.

Social media nerd rage

In truth most disagreements will hit the personal barrier very early and the rest of the discussion is worthless. Unfortunately not only is the time wasted but the disagreement often turns to cheap insults. Some people start the conversations angry, because they expect the other side to be angry too.

I don't know how this mindset gets cultivated, but I bet social media does not make it any better. I used to be very active on social media, engaging in discussions with strangers and these days I barely exist outside of this website. Effortless nature of adding to the pile on social media creates a ripe environment for low quality discussion where no party expects others to do much other than dismiss and insult.

On the other hand, having to write out your thoughts for something that will live longer, also gives you a lot of time to challenge those thoughts and calm down. Many of my posts on this website go through a couple of versions before they are released. Some earlier versions contain traces of the "nerd rage", whereas the final post may have a joke or a jab at something, but is ultimately designed to be positive.

Whoever spends enough time to read a longer, more elaborate post, will also have more time to consider the authors points and since this longer post covers more ground there are fewer opportunities for misunderstandings. This is much healthier for everyone involved.

Conclusion

We are different and we cannot help it. All we can do is decide how we deal with that reality.

Information age is moving us towards short-term, low-quality channels which are optimized for engagement. We must recognize this and instead choose higher quality ways of expressing ourselves which do not exist to generate external validation or provoke an emotional response.

Focus should not be on "winning" a debate, but on being true to yourself and allowing others to learn from your point of view. Even in hard disagreement we should allow the other person to exist, since the alternative only creates bubbles where nobody ever learns anything.